x86/alt: Fix build when CONFIG_LIVEPATCH is disabled
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 29 Aug 2018 10:55:32 +0000 (11:55 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 29 Aug 2018 13:28:48 +0000 (14:28 +0100)
commit70c0144f924aea141574390faa5b35900e97a1a3
tree66024e9e05e843526610b4e0368e3915470084f1
parentb28cd21c36288a01ae61ed4f557802abc8ee03e4
x86/alt: Fix build when CONFIG_LIVEPATCH is disabled

c/s b28cd21c3628 "x86/build: Use new .nops directive when available"
introduced a __read_mostly boolean which is included if the toolchain supports
the .nops directive.

When CONFIG_LIVEPATCH is compiled out, alternative.o is expected to be a fully
init module, and toolchain_nops_are_ideal trips the build system check:

  Error: size of alternative.o:.data.read_mostly is 0x01
  /local/xen.git/xen/Rules.mk:206: recipe for target 'alternative.init.o' failed
  make[3]: *** [alternative.init.o] Error 12

Introduce init_or_livepatch_read_mostly and switch the annotation for
toolchain_nops_are_ideal.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/arch/x86/alternative.c
xen/include/xen/livepatch.h